package com.link.base.base.map.controller;

import com.link.base.base.map.service.BaiduMapService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * 调用百度地图webapi方法
 *
 * @author LiQun
 * @date 2019/3/28 22:58
 */
@Controller
@RequestMapping("/link/bdmap")
public class BaiduMapController {

    @Resource
    private BaiduMapService baiduMapService;

    @RequestMapping(value = "/suggestion")
    @ResponseBody
    public Map<String, Object> suggestion(String keywords,String location) throws Exception {
        Map<String, Object> result = new HashMap<>(16);
        try {
            result = baiduMapService.suggestion(keywords,location);
            result.put("success", true);
        } catch (Exception e) {
            result.put("success", false);
            result.put("result", e.getMessage());
        }
        return result;
    }

}
